﻿Imports QLTHUVIEN.DTO
Public Class BoPhanDAO
    Public Function LayDanhSach() As DataTable
        Dim strSql As String = "SELECT MaBoPhan, TenBoPhan FROM BoPhan WHERE isDelete = 'False'"
        Dim dt As DataTable = DataProvider.ExecuteQuery(strSql)
        Return dt
    End Function

    Public Sub ThemBoPhan(ByVal BoPhan As BoPhanDTO)
        Dim strSql As String = "INSERT INTO BOPHAN(TenBoPhan) VALUES(N'" & BoPhan.TenBoPhan & "')"
        DataProvider.ExecuteQuery(strSql)
    End Sub

    Public Sub SuaBoPhan(ByVal BoPhan As BoPhanDTO)
        Dim strSql As String = "UPDATE BOPHAN SET TenBoPhan = N'" & BoPhan.TenBoPhan & "' WHERE MaBoPhan = " & BoPhan.MaBoPhan
        DataProvider.ExecuteQuery(strSql)
    End Sub

    Public Sub XoaBoPhan(ByVal BoPhan As BoPhanDTO)
        Dim strSql As String = "UPDATE BOPHAN SET isDelete ='" & BoPhan.IsDelete.ToString() & "' WHERE MaBoPhan = " & BoPhan.MaBoPhan
        DataProvider.ExecuteQuery(strSql)
    End Sub
End Class
